﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Invoicing.Model.Results
{
    [DataContract]
    public class JsonEntitySet<T> where T : MBase
    {
        [DataMember]
        public string Message { get; set; }
        [DataMember]
        public ModelCollectionBase<T> Data { get; set; }
        [DataMember]
        public bool Success { get; set; }
        [DataMember]
        public int Total { get; set; }

        public JsonEntitySet(ModelCollectionBase<T> resultSet, string message = "", bool success = true)
        {
            if (resultSet != null)
            {
                this.Data = resultSet;
                this.Total = resultSet.TotalRecordsCount;
            }
            this.Message = message;
            this.Success = success;
        }
    }
}
